*! version 3.0 13Mar2017 
*! by Hung-Jen Wang
*!    Department of Economics, National Taiwan University
*!    wangh@ntu.edu.tw

*! Generate missing value index.
*! Usage: findmix varlist, i(var)
*! update to version 6 on Dec 10, 2002

capture program drop findmis
program define findmis

  version 6.0
  syntax varlist [if] [in], GENerate(string)

   marksample touse, nov

  quie gen byte `generate' = 0

   tokenize `varlist'

  while "`1'" ~= ""{

     quie replace `generate' = 1 if `touse' & `1' == .

     mac shift
  }
end
exit
